import { createApp } from 'vue'
import App from './App.vue'
import router from './router/index'
import { store, key } from './store'
import elementPlus from './plugins/element-plus'
import 'xe-utils'
import VXETable from 'vxe-table'

// 加载全局样式
import './styles/index.scss'
import 'vxe-table/lib/style.css'

// 自动注册全局组件
// const modules = import.meta.globEager('./components/**/index.ts')
// for (const path in modules) {
//   app.use(modules[path].default)
// }

import AppTextEditor from '@/components/textEditor/index.vue' // 文本编辑器
import AppPagination from '@/components/Pagination/index.vue' // 分页器
import AppDialogForm from '@/components/DialogForm/index.vue' // 弹窗
// import PageContainer from '@/components/PageContainer/index.vue' // 布局
import AppCard from '@/components/Card/index.vue' // 卡片(背景)
import AppDraggable from '@/components/Draggable/index.vue' // 拖拽
import AppIcon from '@/components/Icon/index.vue' // 图标

const app = createApp(App)

app.use(router)
app.use(store, key)
app.use(elementPlus, { size: 'small', zIndex: 2000 })
app.use(VXETable)
app.component('AppTextEditor', AppTextEditor)
app.component('AppPagination', AppPagination)
app.component('AppDialogForm', AppDialogForm)
// app.component('PageContainer', PageContainer)
app.component('AppCard', AppCard)
app.component('AppDraggable', AppDraggable)
app.component('AppIcon', AppIcon)

app.mount('#app')
